package com.hqyj.controller;


import com.hqyj.pojo.Manager;

import com.hqyj.service.managerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;


@Controller
@RequestMapping("/manager")
public class managerController {
    @Autowired
    private managerService managerService;

//    @RequestMapping("/login")
//    @ResponseBody
//    public String login(String username, String password){
//        Manager manager =managerService.login(username,password);
//        if(manager != null){
//              return "1";
//        }else {
//           return "0" ;
//        }
//    }

    @RequestMapping("/login")
    @ResponseBody
    public Map<String, Object> login(String username, String password){

        return managerService.login(username, password);

    }

    @RequestMapping("/logout")
    public String logout(){
        //调用服务层实现业务
         managerService.logout();
         return "login";
    }
}
